#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QTcpSocket>
#include <QHostAddress>
#include <QtNetwork/QtNetwork>
#include <QImage>
#include <stdio.h>

#define		video_width		640
#define 	video_height	480

namespace Ui {
class Widget;
}

typedef struct Frame_Buffer{
    unsigned char buf[video_width*video_height*3];
    int length;
}FrameBuffer;

class Widget : public QWidget
{
    Q_OBJECT

public:
    QByteArray Img_Data;   //存放图像字节数据
    int Recv_Length=0;     //存放图像数据长度
    QByteArray temp_array;

    explicit Widget(QWidget *parent = nullptr);
    ~Widget();

    void Senddata_SLOT();

private slots:
    void on_push_open_clicked();
    void on_push_close_clicked();
    void on_push_open_2_clicked();
    void connected_SLOT();
    void readyRead_SLOT();
    void yuv_to_rgb(unsigned char *yuv, unsigned char *rgb);

private:
    Ui::Widget *ui;
    QString ipdata;
    QTcpSocket  *Clien_socket;
    QString IP="192.168.31.124"; //服务端IP
    int Port=1900;             //服务端端口
};

#endif // WIDGET_H
